//
//  HelpRecordTableViewCell.m
//  WideHelp
//
//  Created by ENERGY on 2018/8/9.
//  Copyright © 2018年 ENERGY. All rights reserved.
//

#import "HelpRecordTableViewCell.h"

@interface HelpRecordTableViewCell()
@property (nonatomic, strong)UILabel * nameLab;
@property (nonatomic, strong)UILabel * diseaseLab;
@property (nonatomic, strong)UILabel * moneyLab;
@property (nonatomic, strong)UIView * lineView;
@end
@implementation HelpRecordTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = [UIColor whiteColor];
        __weak typeof (self)weakSelf = self;
        [self.contentView addSubview:self.nameLab];
        [self.contentView addSubview:self.diseaseLab];
        [self.contentView addSubview:self.moneyLab];
        [self.contentView addSubview:self.lineView];
        [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.equalTo(weakSelf.contentView);
            make.width.mas_offset(SCREEN_WIDTH/3);
            make.bottom.equalTo(weakSelf.lineView.mas_top);
        }];
        [self.diseaseLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.nameLab.mas_right);
            make.top.bottom.width.equalTo(weakSelf.nameLab);
        }];
        [self.moneyLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.diseaseLab.mas_right);
            make.top.bottom.width.equalTo(weakSelf.nameLab);
        }];
        [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(weakSelf.contentView);
            make.height.mas_offset(1/WIDTH_6_SCALE);
        }];
    }return self;
}
- (UILabel *)nameLab{
    if (!_nameLab) {
        _nameLab = [[UILabel alloc] init];
        _nameLab.font = DEF_FontSize_14;
        _nameLab.textColor = [UIColor blackColor];
        _nameLab.textAlignment = NSTextAlignmentCenter;
        _nameLab.text = @"王宝强";
    }return _nameLab;
}
- (UILabel *)diseaseLab{
    if (!_diseaseLab) {
        _diseaseLab = [[UILabel alloc] init];
        _diseaseLab.font = DEF_FontSize_14;
        _diseaseLab.textColor = [UIColor blackColor];
        _diseaseLab.textAlignment = NSTextAlignmentCenter;
        _diseaseLab.text = @"阑尾炎";
    }return _diseaseLab;
}
- (UILabel *)moneyLab{
    if (!_moneyLab) {
        _moneyLab = [[UILabel alloc] init];
        _moneyLab.font = DEF_FontSize_14;
        _moneyLab.textColor = [UIColor blackColor];
        _moneyLab.textAlignment = NSTextAlignmentCenter;
        _moneyLab.text = @"10000";
    }return _moneyLab;
}
- (UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = getColor(@"eeeeee");
    }return _lineView;
}
- (void)setModel:(NSDictionary *)model{
    _model = model;
    self.nameLab.text = model[@"realname"];
    self.moneyLab.text = model[@"help_money"];
    self.diseaseLab.text = model[@"help_ill"];
}
@end
